package day0725;

import java.util.Arrays;

public class Test5 {
    static void reverse(int[] b){
        for(int i=0; i<b.length/2;  i++) {
            int t = b[i];   //b[3]              //0  3
            b[i] = b[b.length-1-i];             //1  2
            b[b.length-1-i] = t;
        }
        System.out.println(Arrays.toString(b));
    }
    public static void main(String[] args) {
        int[]  a=   new int[  (int)(Math.random()*50)];//1.创建一个容量小于50的数组(元素的个数是任意)
        for(int i=0; i<a.length; i++){//2.给a数组放入length个小于100的随机数
            a[i]=(int)(Math.random()*100);
        }
        System.out.println(Arrays.toString(a));
        Test5.reverse(a);//3.用reverse方法将元素颠倒顺序
    }
}
